package com.taptech.doufu.util;

import android.content.Context;
import android.net.ConnectivityManager;

public class NetworkUtil {

	public static boolean isNetworkUsable(Context context) {

		try {
			ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
			if (cm == null || cm.getActiveNetworkInfo() == null) {
				return false;
			}
			return cm.getActiveNetworkInfo().isAvailable();
		} catch (NullPointerException e) {
			return false;
		}

	}
}
